package handlers

import (
	"sales-web/server/dal"

	"github.com/gin-gonic/gin"
)

type Handler struct {
	dbc *dal.DBC
}

// Option use to init obj.
type Option func(*Handler)

// New create handler obj.
func New(options ...Option) *Handler {
	h := &Handler{}

	for _, op := range options {
		op(h)
	}

	return h
}

func WithDBC(dbc *dal.DBC) Option {
	return func(h *Handler) {
		h.dbc = dbc
	}
}

func (h *Handler) Ping(c *gin.Context) {
	SendOkResp(c, "pong")
}
